/*
 * Score.h
 *
 *  Created on: 2013. 10. 30.
 *      Author: mega@gamevil.com
 */

#ifndef SCORE_H_
#define SCORE_H_

namespace ProjectZ { namespace NLogic {

class Score
{
public:
	struct Data
	{
		uint32_t	wp_cur_week;
		uint32_t	wp_last_week;
		time_t		wp_reg_date;
		time_t		wp_last_reg_date;

		void Clear()
		{
			wp_last_week	= 0;
			wp_cur_week		= 0;
			wp_reg_date		= 0;
			wp_last_reg_date = 0;
		}
	};

	struct Medal
	{
		int	gold;
		int silver;
		int bronze;

		Medal() : gold(0), silver(0), bronze(0) {}

		void Clear()
		{
			gold	= 0;
			silver	= 0;
			bronze	= 0;
		}
	};

public:
	Score(User * pUser);
	virtual ~Score();

	void		Initialize();
	void		Finalize();

	Data &		GetData() { return _data; }
	void		SetMemcache();
	void		SetRedis(int winPoint);

	Medal &		GetMedal() { return _medal; }
	void		SetMedal(Medal medal) { _medal = medal; }
	void		SetMedalMemcached();
	void		LoadMedal();
	void		SaveMedal();

private:
	User *	_user;
	Data	_data;
	Medal	_medal;
};

} /* namespace NLogic */ } /* namespace ProjectZ */

#endif /* SCORE_H_ */
